#include "mystdio.h"
#include <unistd.h>

int main()
{
    myFILE *fp = myfopen("log.txt", "a");
    if (fp == NULL)
    {
        printf("myfopen fail!\n");
    }
    
    const char *msg = "hello hajimi";
    int cnt = 10;
    while (cnt--)
    {
        myfputs(msg, fp);
        printf("debug: outbuffer: %s, cnt: %d\n", fp->outbuffer, cnt);
        sleep(1);
    }

    myfclose(fp);
    printf("write file done!\n");
    return 0;
}
